package com.lihao.controller;

import com.lihao.entity.Course;
import com.lihao.service.intf.CourseService;
import com.lihao.vo.PageVo;
import com.lihao.vo.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @ClassName CourseController
 * @Description TODO
 * @Author LiHao
 * @Date 2022/11/19 13:22
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/course/")
public class CourseController {

    @Resource
    public CourseService service;
    @PostMapping("add.do")
    public R add(Course course){
        return service.add(course);
    }

    @PostMapping("del.do")
    public R del(int id){
        return service.del(id);
    }

    @PostMapping("update.do")
    public R update(Course course){
        return service.update(course);
    }

    @GetMapping("page.do")
    public PageVo page(int page,int limit){
        return service.queryPage(page, limit);
    }
}
